<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>收货地址</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />		
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<link href="../../css/xq.css" />
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../../js/fanhui.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			.white {
				color: white;
			}
		</style>
	</head>
	<body>
		<div id="app-shdz">
			<header>
				<van-nav-bar @click-left="onClickLeft" @click-right="onClickRight" style="background-color: red;color: #000000;">
					<van-icon slot="left" name="arrow-left" color="white"></van-icon>
					<label slot="title" class="white">收货地址</label>
					<label slot="left" class="white">返回</label>
					<label slot="right" class="white">删除</label>
				</van-nav-bar>
			</header>
			<section>
				<van-address-list v-model="chosenAddressId" :list="list" @add="onAdd" @edit="onEdit"></van-address-list>
			</section>
		</div>
	</body>
	<script type="text/javascript">
		var vm = new Vue({
			el: "#app-shdz",
			data: {
				chosenAddressId: "1",
				list: [{
						id: '1',
						name: '张三',
						tel: '13000000000',
						address: '浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室'
					},
					{
						id: '2',
						name: '李四',
						tel: '1310000000',
						address: '浙江省杭州市拱墅区莫干山路 50 号'
					}
				]
				

			},
			methods: {
				onClickLeft: function() {
					plus.webview.close(plus.webview.currentWebview(),"slide-out-left");
					console.log("返回个人中心")
				},
				onClickRight: function() {
					console.log(this.chosenAddressId);
					console.log(this.list[this.chosenAddressId-1].id)
					if(this.chosenAddressId==this.list[this.chosenAddressId-1].id){
						console.log("删除");
						vm.$toast.success("删除未开发");
					}
					
				},
				onAdd: function() {
					plus.webview.open("we.html","we");
					console.log("添加收货地址");
				},
				onEdit: function() {
					console.log("edit");
				}
			}
		})
	</script>
</html>